home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
ftp.cs.arizona.edu
/
ftp.cs.arizona.edu.tar
/
ftp.cs.arizona.edu
/
icon
/
newsgrp
/
group00b.txt
/
000112_icon-group-sender_Thu Oct 26 07:59:42 2000.msg
< prev
next >
Wrap
Internet Message Format
|
2001-01-03
|
2KB
Return-Path: <icon-group-sender>
Received: (from root@localhost)
by baskerville.CS.Arizona.EDU (8.11.1/8.11.1) id e9QEvkf22309
for icon-group-addresses; Thu, 26 Oct 2000 07:57:46 -0700 (MST)
Message-Id: <200010261457.e9QEvkf22309@baskerville.CS.Arizona.EDU>
From: Bob Ardler <ardler@argonet.co.uk>
To: icon-group@cs.arizona.edu
Date: Thu, 26 Oct 2000 12:32:54 +0100
Subject: Re: Yet another Newbie question....
User-Agent: Pluto/2.02b (RISC-OS/3.60)
Errors-To: icon-group-errors@cs.arizona.edu
Status: RO
Content-Length: 1540
Shamim Mohamed <shamim@drones.com> :
> symbiot@my-deja.com :
> > if member(&letters,line[index]) then totalcount +:= 1
> > barfed with
> > set or table expected.
> > Offending value &letters
> > Isn't &letters a cset? You can use it in other "set" functions,
> > can't you? What am I missing?
> Homework? You really need a book on Icon. If you don't want to buy
> the text, download and read Tom Christopher's free on-line book.
> There's a link to it from the U of A Icon web page
> http://www.cs.arizona.edu/icon/.
> String scanning is the most natural way of doing this. What does
> this code do?
> line ? while tab(upto(&letters)) do move(1)
Intimidates? Sends you screaming come back awk, come back perl, all
is forgiven?
Shamin is right in every respect; yet, as a permanent beginner I fell
to the earth twitching and frothing at that "natural" line. Neither
Griswold & Griswold nor Christopher (both excellent and friendly)
always help, say, a student coming from a conventional language who
wants to write a conventional 'if' statement and expects to find a
simple analogue for the predicates s/he's used to.
G&G (The Icon Programming Language, see www.peer-to-peer.com) does
point out that member(X,x) requires X to be a set or table, and a
cset isn't a set. Both books also list the operations on csets (union
++, intersection **, difference -- and complement ~), but I don't
know where or whether they explain that you have to make your own
cset analogue for member() using any() or not-empty intersection or
whatever.